package com.nuonuo.middleware.properties.controller;

import com.nuonuo.middleware.common.tools.utils.JacksonUtil;
//import com.nuonuo.middleware.properties.properties.CompanyProperties;
import com.nuonuo.middleware.drs.client.annotation.DrsValue;
import com.nuonuo.middleware.properties.properties.PlaneProperties;
//import com.nuonuo.middleware.properties.properties.TestProperties;
import com.nuonuo.middleware.properties.properties.SomePlaneProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author duan
 * @version 1.0
 * @date 2023/4/7 14:23
 */
@RestController
@RequestMapping(value = "/test")
public class TestController {
    @Autowired
    private PlaneProperties planeProperties;

    @Autowired
    private SomePlaneProperties somePlaneProperties;

    @DrsValue("${timeout:100}")
    private int timeout;

    @GetMapping(value = "getTimeout")
    public int getTimeout() {
        return timeout;
    }
//
//    @Resource
//    private CompanyProperties companyProperties;
//
//    @Autowired
//    private TestProperties testProperties;
//
//    @GetMapping(value = "getIp")
//    public String getIp(Long serialNum) {
//        return testProperties.getSerialNumMap().get(serialNum);
//    }
//
//
//    @GetMapping(value = "getCompanyInfo")
//    public String getCompanyInfo() {
//        return companyProperties.getId() + ", " + companyProperties.getBlackIds();
//    }

    @DrsValue("${test.key:${user.id:}:}")
    private String appId;

    @Value("${test.key:${user.id:}:}")
    private String topic;

    @GetMapping(value = "getTopic")
    public String getTopic() {
        return appId + "\n" + topic;
    }
    @GetMapping(value = "getPlanProperties")
    public String getPlanProperties() {
        return planeProperties.toString();
    }

    @GetMapping(value = "getSomePlanProperties")
    public String getSomePlanProperties() {
        return somePlaneProperties.toString();
    }
}
